<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="root"></div>
</body>
</html>
<script src="https://unpkg.com/vue@next"></script>
<script>
    const app = Vue.createApp({
        data(){
            return{
                count:1
            }
        },
        mounted(){
            // console.log(this.$refs.count);
        },
        // v-once让标签只渲染一次
        // template:`
        // <div @click="count+=1" v-once>
        //     {{count}}
        // </div>
        // `

        // ref 实际上是获取dom节点 / 组件引用的一个语法
        // template:`
        // <div>
        //     <div ref="count">
        //         {{count}}
        //     </div>
        // </div>
        // `


        // provide  /  inject
        provide:{
           count:1, 
        },
        template:`
        <div>
            <child :count="count" />
        </div>
        `
    });
    app.component('child',{
        props:['count'],
        template:`
        <child-child :count="count" />
        `
    })
    app.component('child-child',{
        inject:['count'],
        template:`
        <div>{{count}}</div>
        `
    })
    const vm = app.mount('#root')
</script>